-- attack_frighten
-- created by zhuangsl
-- 攻击概率震撼敌人

return {
    apply = function(prop, baseValue)
        return baseValue;
    end,

    -- 攻击触发
    trigger = function(who, prop, arg)
        local target = arg;
        -- 概率触发

        local rand = DungeonM.getRandSeed("attack_frighten") % 1000;
        if (rand > prop[3]) then
            return;
        end
        
        local condition = {
            ["end_round"] = CombatM.getRound() + prop[4],
        };

        -- 附加状态
        CombatStatusM.applyStatus(target, "shock", condition);

        -- 触发特技发动事件
        local target = who.dbase:queryTemp("defenser_info")["target"];
        local targetPos;
        if target then
            targetPos = target:getOwner();
        end
        EventMgr.fire(event.SPECIAL_SKILL_TRIGGER, { propId = prop[1], pos = targetPos, });

        return true;
    end,

    record = function(target, prop, path)
        return false;
    end
};
